<%@ Register TagPrefix="uc1" TagName="Footer" Src="../Controls/Footer.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="../Controls/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="HelpCtrl" Src="../Controls/HelpCtrl.ascx" %>
<%@ Page Language="vb"  validateRequest="false" AutoEventWireup="false" Codebehind="OrderStatusUpdate.aspx.vb" Inherits="MIMS_WRS.Web.OrderStatusUpdate"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>Update Order Status</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<script language="javascript" src="../Js/popcalendar.js"></script>
		<script language="javascript" src="../Js/common.js"></script>
		<LINK href="../style.css" type="text/css" rel="stylesheet">
		<script language="JavaScript" src="../js/function.js" type="text/JavaScript"></script>
		<script language="javascript">
		<!--
		var doc=window.document;
		
		
		function body_onload() 
		{
			var ctrlsName = "<%= Me.ControlsName %>";	
			if (doc.getElementById('btnSave'))
				doc.getElementById('btnSave').onclick = btnSave_onclick;
			if (doc.getElementById('btnSaveAndCont'))
				doc.getElementById('btnSaveAndCont').onclick = btnSave_onclick;
			if (window.document.getElementById('btnCancel'))
				window.document.getElementById('btnCancel').onclick = btnCancel_onclick;
			
			var arrName = ctrlsName.split(",");
			for(var i=0;i<arrName.length;i++)
			{	
				if(arrName[i] != "")			
					checkStatusChanging(arrName[i]);
			}
		}
		
		function checkStatusChanging(ctrl) 
		{
			var chkDocSent = doc.getElementById(ctrl+'_chkDocSent');
			var chkPayRecv = doc.getElementById(ctrl+'_chkPayReceive');

			var txtDocSentDate = doc.getElementById(ctrl+'_txtDocSentDate');
			var btnDocSentDate = doc.getElementById(ctrl+'_btnDocSentDate');
			var txtPayRecvDate = doc.getElementById(ctrl+'_txtPayReceiveDate');				
			var btnPayRecvDate = doc.getElementById(ctrl+'_btnPayReceiveDate');
			
			if (chkDocSent.checked) 
			{
				txtDocSentDate.disabled = false;
				btnDocSentDate.style.display = "";
			} 
			else 
			{			
				txtDocSentDate.disabled = true;
				btnDocSentDate.style.display = "none";
			}
			
			if (chkPayRecv.checked) 
			{
				txtPayRecvDate.disabled = false;
				btnPayRecvDate.style.display = "";
			} 
			else 
			{
				txtPayRecvDate.disabled = true;
				btnPayRecvDate.style.display = "none";
			}
		}
		
		function validateDate(ctrl) 
		{		
			var chkDocSent = doc.getElementById(ctrl+'_chkDocSent');
			var chkPayRecv = doc.getElementById(ctrl+'_chkPayReceive');
			
			if (chkDocSent.checked) 
			{
				var txtDS = doc.getElementById(ctrl+'_txtDocSentDate');
				if (txtDS.value == "") 
				{
					alert('Please input doc sent date');
					return false;
				}				
			}
			
			if (chkPayRecv.checked) 
			{
				var txtPR = doc.getElementById(ctrl+'_txtPayReceiveDate');
				if (txtPR.value == "") 
				{
					alert('Please input pay received date');
					return false;
				}				
			}
			
			return true;
		}
		
		
		function btnSave_onclick() 
		{		
			var ctrlsName = "<%= Me.ControlsName %>";
			var arrName = ctrlsName.split(",");
			for(var i=0;i<arrName.length;i++)
			{	
				if(arrName[i] != "")			
				{
					if (!validateDate(arrName[i])) 
						return false;
				}					
			}
			
			if (typeof(Page_ClientValidate) == 'function') 
				return Page_ClientValidate();
							
			return true;
		}
		
		function btnCancel_onclick() 
		{
			return confirm('Are you sure you want to cancel?');
		}
		
		//-->
		</script>
	</HEAD>
	<body leftMargin="0" topMargin="0" onload="body_onload();MM_preloadImages('../images/b_weeklyreporto.gif','../images/b_historyreporto.gif','../images/b_usero.gif')">
		<form id="Form1" method="post" runat="server">
			<table cellSpacing="0" cellPadding="0" width="100%" border="0" id="Table1">
				<uc1:header id="Header1" runat="server"></uc1:header>
				<!-- Submenu: start -->
				<tr>
					<td class="bgsubmenu" align="center" height="30">
						<div class="nlink">
							<table cellSpacing="0" cellPadding="0" width="96%" border="0" id="Table2">
								<tr>
									<td class="txtcolor2">
										<p class="txtcolor2"><span class="txtsmall"><strong>You are here:</strong></span> <A href="../Customer/CustomerList.aspx">
												Customer List</A> / Update order status</p>
									</td>
									<td class="txtcolor2" align="right"><strong><strong><strong>[ <span class="txtnormal"><A href="../Internal/UserList.aspx">
															List of Users</A></span></strong></strong> / <strong><strong><A class="txtcolor2" href="../Admin/User.aspx?usertype=1">
														Create new</A> </strong></strong>]</strong></td>
									<td class="txtcolor2" noWrap align="right" width="70"><span class="plink"><A href="javascript:history.back()"><IMG height="16" hspace="2" src="../images/b_back.gif" width="57" vspace="0" border="0"></A></span></td>
								</tr>
							</table>
						</div>
					</td>
				</tr>
				<tr>
					<td class="bglinetop1" height="1"><IMG height="1" src="../images/1pxl.gif" width="1"></td>
				</tr>
				<!-- Submenu: end -->
				<tr>
					<td class="bgwhite" align="center">
						<table cellSpacing="0" cellPadding="0" width="96%" border="0" id="Table3">
							<tr>
								<td align="center" height="10"><IMG height="1" src="../images/1pxl.gif" width="1"></td>
							</tr>
							<tr>
								<td align="center" height="35">
									<table cellSpacing="0" cellPadding="0" width="100%" border="0" id="Table4">
										<tr vAlign="bottom">
											<td height="25"><span class="title"><strong>UPDATE ORDER STATUS</strong></span></td>
											<td align="right">
												<div class="plink"><strong><span class="txtsmall"><A href="#">
																<uc1:HelpCtrl id="HelpCtrl1" runat="server"></uc1:HelpCtrl></A></span></strong></div>
											</td>
										</tr>
									</table>
									<table id="msgTable" style="DISPLAY: none" height="25" cellSpacing="0" cellPadding="0"
										width="100%" border="0">
										<tr>
											<td class="txthighlight" align="center">Your Order Status has been updated 
												successfully!</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td vAlign="top" align="center">
									<table class="border1" cellSpacing="2" cellPadding="2" width="100%" border="0" id="Table5">
										<tr>
											<td align="center" bgColor="#f9f9f9">
												<TABLE cellSpacing="0" cellPadding="3" width="100%" border="0" id="Table6">
													<TR class="bgmenu">
														<TD align="right">&nbsp;</TD>
														<TD align="center">&nbsp;</TD>
														<TD>&nbsp;</TD>
													</TR>
													<TR class="txtnormal">
														<TD align="center" colSpan="6">
															<TABLE cellSpacing="0" cellPadding="3" border="0" id="Table7">
																<TR class="txtnormal">
																	<TD align="right">Customer:</TD>
																	<TD>&nbsp;</TD>
																	<TD class="txtcolor2"><strong><asp:label id="lblCustomerName" runat="server"></asp:label></strong></TD>
																</TR>
																<TR class="txtnormal">
																	<TD align="right">Week:</TD>
																	<TD>&nbsp;</TD>
																	<TD class="txtcolor2"><strong><asp:label id="lblWeek" runat="server"></asp:label></strong></TD>
																</TR>
																<TR class="txtnormal">
																	<TD align="right">Year:</TD>
																	<TD>&nbsp;</TD>
																	<TD class="txtcolor2"><strong><asp:label id="lblYear" runat="server"></asp:label></strong></TD>
																</TR>
															</TABLE>
														</TD>
													</TR>
													<TR class="txtnormal">
														<TD colSpan="6"><strong>Order Information:</strong>
														</TD>
													</TR>
													<TR class="txtnormal">
														<TD align="center" colSpan="6"><asp:placeholder id="PlaceHolder1" runat="server"></asp:placeholder></TD>
													</TR>
												</TABLE>
												<TABLE cellSpacing="0" cellPadding="3" width="100%" border="0" id="Table8">
													<TR class="txtnormal">
														<TD class="txtsmall" align="center" height="40"><asp:button id="btnLoad" runat="server" Width="140px" CausesValidation="False" Text="Load previous week"
																CssClass="button"></asp:button>&nbsp;<asp:button id="btnSave" runat="server" Text="Save" CssClass="button"></asp:button>&nbsp;<asp:button id="btnSaveAndCont" runat="server" Text="Save &amp; Continue" CssClass="button"></asp:button>&nbsp;<asp:button id="btnReset" runat="server" CausesValidation="False" Text="Reset" CssClass="button"></asp:button>&nbsp;<asp:button id="btnCancel" runat="server" CausesValidation="False" Text="Cancel" CssClass="button"></asp:button></TD>
													</TR>
												</TABLE>
											</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td align="right">&nbsp;</td>
							</tr>
						</table>
					</td>
				</tr>
				<uc1:footer id="Footer1" runat="server"></uc1:footer></table>
		</form>
	</body>
</HTML>
